﻿Imports System.Data.Linq
Imports System.Linq
Imports TNCDAL

Public Class HBLController
    Private objRepository As New HBLRepository

   

    Public Function SelectRecordById(ByVal id As Integer) As tblHBL
        Return objRepository.SelectRecordById(id)
    End Function

    Public Sub Insert(ByVal obj As tblHBL)
        objRepository.Insert(obj)
    End Sub

    Public Sub Update(ByVal obj As tblHBL)
        objRepository.Update(obj)
    End Sub

    Public Sub Delete(ByVal obj As tblHBL)
        objRepository.Delete(obj)
    End Sub

    ''' <summary>
    ''' Lấy danh sách thông tin các HBL của File
    ''' </summary>
    ''' <param name="id_FileMBL"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function GetCustomHBLByFileMBL(ByVal id_FileMBL As Integer) As IQueryable
        Return objRepository.GetHBLByFileMBL(id_FileMBL)
    End Function

    ''' <summary>
    ''' Lấy danh sách thông tin các HBL của File
    ''' </summary>
    ''' <param name="id_file"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function GetCustomHBLByFile(ByVal id_file As Integer) As IQueryable
        Return objRepository.GetHBLByFile(id_file)
    End Function

    Public Function CalculateSumNW(ByVal ID_HBL As Integer) As Double
        Return objRepository.CalculateSumNW(ID_HBL)
    End Function

    Public Function CalculateSumGW(ByVal ID_HBL As Integer) As Double
        Return objRepository.CalculateSumGW(ID_HBL)
    End Function

    Public Function CalculateSumCBM(ByVal ID_HBL As Integer) As Double
        Return objRepository.CalculateSumCBM(ID_HBL)
    End Function
End Class
